package util

import (
	"os/exec"
	"syscall"
)

//windows 下用cmd打开html
func OpenHTML(html_str string) {
	// 有GUI调用
	//exec.Command(`cmd`, `/c`, `start`, `http://localhost:8080/static/index.html`).Start()
	// 无GUI调用
	cmd := exec.Command(`cmd`, `/c`, `start`, html_str)
	cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
	cmd.Start()
}

//执行打印脚本
func RunPrintBat() {
	cmd := exec.Command(`cmd`, `/c`, `print.bat`)
	cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
	cmd.Start()
}

//播放错误提示音
func Play_sound() {
	cmd := exec.Command("cmd", "/C", "cmdmp3win.exe", "err.mp3")
	cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
	cmd.Start()
}
